package com.chapter2.sort;

import java.util.PriorityQueue;

import org.junit.Test;

/** 
 * @ClassName: PriorityQueueAnalysis 
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @author minjun minjun@bw30.com
 * @date 2015-2-17 上午2:18:47 
 *  
 */
public class PriorityQueueAnalysis {

	@Test
	public void testPriority(){
		PriorityQueue<String> queue=new PriorityQueue<String>();
		queue.add("jack");
		queue.add("tom");
		queue.add("andy");
		queue.add("cindy");
		queue.add("annie");
		
		while(!queue.isEmpty())
			System.out.println(queue.poll());
	}
	
	@Test
	public void testMaxQ(){
		MaxQ<String> q=new MaxQ<String>();
		q.add("jack");
		q.add("tom");
		q.add("yndy");
		q.add("cindy");
		q.add("annie");
		
		System.out.println(q.deleteMax());
		System.out.println(q.deleteMax());
		System.out.println(q.deleteMax());
		System.out.println(q.deleteMax());
		System.out.println(q.deleteMax());
	}
}
